
package com.wutianyi.interesting;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.lang.RandomStringUtils;

public class MapDemo {

	public static void main(String[] args) {

		ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();

		map.put("test_1", "test_1");
		map.put("test_2", "test_2");
		map.put("test_3", "test_3");

		for(Entry<String, String> entry : map.entrySet()) {
			if(entry.getKey().equals("test_2")) {
				map.remove(entry.getKey());
			}
			if(entry.getKey().equals("test_3")) {
				map.put("test_4", "test_4");
			}
			if(map.contains(entry.getKey()))
				System.out.println(entry.getKey());
		}
		System.out.println(map);
	}
}
